﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
using System.ComponentModel;
namespace CoreData
{
    public class Payment_Method
    {
        [Description("ID")]
            public long ID{get;set;}
        [Description("Mã")]
            public string Code{get;set;}
        [Description("Tên")]
            public string Name{get;set;}
           [Description("Ghi chú")]
            public string Note{get;set;}
        [Description("Sử dụng")]
            public bool Active{get;set;}
         
        public Payment_Method()
        {       
                            Code ="";   
                            Name ="";   
                            //Type ="";   
                            Note ="";   
                           // Active ="";   
        }
        
       static Payment_Method DynamicCast<T>(object row_data, object row_header) where T : Payment_Method
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           Payment_Method ret = new Payment_Method();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "ID":
                        ret.ID = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "Code":
                        ret.Code = ConvertObject.ToString(dt[column]);
                       break;
                      case  "Name":
                        ret.Name = ConvertObject.ToString(dt[column]);
                       break;
                  
                      case  "Note":
                        ret.Note = ConvertObject.ToString(dt[column]);
                       break;
                    
                
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
